package com.study.manage.constant;

public class Url {

  // 用户
  public final static String REG_CODE = "/users/reg_code"; // 注册验证码
  public final static String FOR_CODE = "/users/for_code"; // 密码重置验证码
  public final static String LOGIN = "/users/login"; // 登录
  public final static String LOGOUT = "/users/logout"; // 登出
  public final static String REGISTER = "/users/register"; // 注册
  public final static String FORGET = "/users/forget"; // 重置密码
  public final static String SCAN_LOGIN = "/users/scan_login"; // App扫描登录
  public final static String CHANGE_PASSWD = "/users/change_passwd"; // 修改密码

  public final static String USER_DETAIL = "/users/{1}/userdetail"; // {userId} 用户详情

  // blog
  public final static String blogs_tag = "/blogs/tag/{1}"; // {tagId} 类别下的blog
  public final static String blogs_hot = "/blogs/hot"; // 热门下的blog

  // tag
  public final static String TAGS = "/tags"; // 分类列表

  // 取得app最新版本
  public final static String VERSIONS = "/versions"; // 版本

  public static String getUrl(String serverUrl, String url, Object... args) {
    if (args != null) {
      for (int i = 0; i < args.length; i++) {
        url = url.replaceFirst(new StringBuilder("\\{").append(i + 1).append("\\}").toString(),
            args[i].toString());
      }
    }
    return new StringBuilder(serverUrl).append(url).toString();
  }



}
